import {Component, OnInit, ViewChild} from '@angular/core';
import {ActivatedRoute, Router} from "@angular/router";
import {SingleOpenWinService} from "../../shared/service/single-open-win.service";
import {CamManageListComponent} from "../cam-manage-list/cam-manage-list.component";

@Component({
  selector: 'app-cam-manage-home',
  templateUrl: './cam-manage-home.component.html',
  styleUrls: ['./cam-manage-home.component.css']
})
export class CamManageHomeComponent implements OnInit {

  userId:string = this.routerInfo.snapshot.queryParams["userId"];
  @ViewChild(CamManageListComponent) childList:CamManageListComponent;

  constructor(
    private routerInfo:ActivatedRoute,
    private router:Router,
    private singleOpenWinService:SingleOpenWinService
  ) { }

  ngOnInit() {
  }

  newVehicle(){
    this.childList.onSelect(null);
    this.singleOpenWinService.oidChange.emit("new");
    this.router.navigateByUrl('camManage/new');
    // this.router.navigate(["camManage","new"],{queryParams:{userId:this.userId}});
  }
}
